package com.android.antelopeapp.view;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;

import com.android.antelopeapp.R;

import in.srain.cube.views.ptr.PtrFrameLayout;
import in.srain.cube.views.ptr.PtrUIHandler;
import in.srain.cube.views.ptr.indicator.PtrIndicator;

/**
 * Created by jiang on 2015/5/29.
 */
public class PtrHeader  extends FrameLayout implements PtrUIHandler
{
    TextView textView;
    public PtrHeader(Context context){
        super(context);
        init();
    }

    private void init(){
        View view= LayoutInflater.from(getContext()).inflate(R.layout.view_ptrheader,this);
        textView=(TextView)view.findViewById(R.id.ptr_header_text);
        textView.setText("放开我哇...");
    }
    @Override
    public void onUIReset(PtrFrameLayout ptrFrameLayout) {

    }

    @Override
    public void onUIRefreshPrepare(PtrFrameLayout ptrFrameLayout) {

    }

    @Override
    public void onUIRefreshBegin(PtrFrameLayout ptrFrameLayout) {

    }

    @Override
    public void onUIRefreshComplete(PtrFrameLayout ptrFrameLayout) {

    }

    @Override
    public void onUIPositionChange(PtrFrameLayout ptrFrameLayout, boolean b, byte b2, PtrIndicator ptrIndicator) {
        textView.setVisibility(VISIBLE);
        invalidate();
    }
}
